program QueueTests;

{$IFDEF FPC}
  {$MODE Delphi}{$H+}
{$ENDIF}

uses
  Classes,
  sets,
  queuetest,
  Windows;
const
  MaxCount = 100*1000;
var
  p1,p2: TProducer;
  c1,c2: TConsumer;
  ticks: Integer;
begin
  ticks := GetTickCount;

  p1 := TProducer.Create(MaxCount,  1);
  p2 := TProducer.Create(MaxCount, -1);

  c1 := TConsumer.Create(MaxCount);
  c2 := TConsumer.Create(MaxCount);

  c1.WaitFor;
  c2.WaitFor;

  WriteLn('c1.Total + c2.Total (deve ser zero): ', c1.Total+c2.Total);
  WriteLn;
  WriteLn('Rounds/sec: ', 1000*MaxCount div (GetTickCount - ticks));
  ReadLn;

  p1.free; p2.Free; c1.free; c2.free;
end.

